package cjyyp.day01;

import lombok.extern.slf4j.Slf4j;

public class 习题_泡茶问题 {
    public static void main(String[] args) throws InterruptedException {
        Thread1 thread1=new Thread1();
        thread1.start();
    }

}

@Slf4j
class Thread1{
    private Thread thread;
    public void start() throws InterruptedException {
        thread=new Thread(()->{
            //洗水壶
            log.debug("线程1正在洗水壶");
            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("线程1已经洗好洗水壶");
            //这个线程洗茶壶，洗茶杯，拿茶叶
            Thread t2=new Thread(()->{
                log.debug("线程2:洗茶壶，洗茶杯，拿茶叶");
                try {
                    Thread.sleep(4000L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                log.debug("线程2:做完了");
            });
            t2.start();
            log.debug("线程1:烧开水");
            try {
                Thread.sleep(6000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("线程1：烧开水结束");
        });
        thread.start();
    }
}